#include "k_defines.h"
#include "system.h"
#include "memory.h"
#include "screen.h"

k_isr_unhandled()
{
	kputs("Unhandled inturrupt!\n");
	for(;;);
}

int ktick = 0;
k_isr_timer()
{
	ktick++;
	if (!(ktick % 180))
		kputs("Timer tick!\n");
}
/*
volatile k_isr_test()
{
	unsigned char sc;
	asm volatile ("pusha");
	sc = inportb(0x60);
	kputs("!");
	asm volatile ("popa");
	outportb(0x20,0x20);
}
*/

int keydown = 0;
k_isr_keyboard()
{
	unsigned char sc;
	sc = inportb(0x60);
	kputhexb(sc);
	kputch('\n');
	if (sc & 0x80 ) {
		keydown = 0;
	} else {
		keydown = 1;
	}
}
/*
k_install_isr(unsigned short addr, unsigned char idx)
{
	volatile unsigned short* a;
	a = (8*idx)+0x200;
	*a = addr;
}
*/

k_main() // like main
{
	init_screen_text();
//	k_install_isr(&k_isr_test,33);

	kputs( "Now in YaongTail Kernel\n=)\n");
	kputs("Hello World\n");

	for(;;);
};

